package com.ye.zcswzlms.utils;

import java.nio.charset.StandardCharsets;
import java.util.Random;

public class SaltGenarator {

    public static final char[] SALT = "QWERTYUIOPLKJHGFDSAZXCVBNMqwertyuioplkjhgfdsazxcvbnm!@#$%&*()1234567890".toCharArray();

    public static String getSalt(int num){
        StringBuilder sb = new StringBuilder(num);

        for (int i = 0; i < num; i++) {
            char ch = SALT[new Random().nextInt(SALT.length)];
            sb.append(ch);
        }

        return sb.toString();

    }

    public static void main(String[] args) {
        System.out.println("getSalt(5) = " + getSalt(20));
    }
}
